home *** CD-ROM | disk | FTP | other *** search
- #define OLDROUTINELOCATIONS 0
- #define OLDROUTINENAMES 0
- #define SystemSevenOrLater 1
-
- #include "MoveableModalDialog.h"
-
- pascal void MoveableModalDialog (ModalFilterUPP mfp, short *itemHit)
- {
- EventRecord event;
- DialogRef pop, dummy;
- WindowRef whichWindow;
- short partCode;
- Boolean handledIt = false;
-
- pop = FrontWindow( );
- *itemHit = -1;
-
- do
- {
- WaitNextEvent (everyEvent & ~highLevelEventMask, &event, GetCaretTime( ), nil);
-
- switch (event.what)
- {
- case mouseDown:
-
- partCode = FindWindow (event.where, &whichWindow);
-
- if (whichWindow != pop)
- {
- if (partCode == inSysWindow)
- SystemClick (&event,whichWindow);
- else
- SysBeep(10);
- break;
- }
-
- if (inDrag == partCode)
- {
- Rect dragBounds;
-
-
- dragBounds = qd.screenBits.bounds;
- InsetRect (&dragBounds, 4, 4);
- DragWindow (pop, event.where, &dragBounds);
- break;
- }
-
- // fall thru
-
- default:
-
- if (mfp)
- handledIt = CallModalFilterProc (mfp,pop,&event,itemHit);
-
- if (!handledIt && IsDialogEvent(&event))
- DialogSelect(&event,&dummy,itemHit);
-
- break;
- }
- }
- while (*itemHit == -1);
- }
-